function [ k, t ] = sinc_gen( sampling_rate, cutfq, samples )

T = 1 / sampling_rate; 

if (nargin == 2)
    samples = 160 / (cutfq*2 / sampling_rate); % experimental
end

tout = T * (1:samples); 
tout = tout - T*(samples+1)/2;
B = 2*cutfq;
k = sinc(B*tout);
k = k / trapz(k);

if (nargout == 2)
    t = tout;
end

end

